<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!-- JSTL TagLibs -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>

<!-- Struts2 TagLibs -->
<%@ taglib prefix="s" uri="/struts-tags" %>


<%@ page import="java.util.*" %>
<%
Map<String, String> testmap = new HashMap<String, String>();
Enumeration<?> enu = request.getParameterNames();
while(enu.hasMoreElements()) {
	String key = (String)enu.nextElement();
	testmap.put(key, request.getParameter(key));
}
request.setAttribute("param_map", testmap);
%>

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/oxy4j/statics/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/oxy4j/statics/css/oxy.css">
<title>Test JSP Page</title>
<style>
.background-white{
	background-color:white;
}
</style>
</head>
<body>
<div class="container">
	<legend><h1>JSP测试</h1><a href="/oxy4j">主页</a></legend>
	
	<div class="container">
		<div class="well">
			<legend>EL表达式 和 JSTL标签</legend>
			<pre title="测试描述">EL+JSTL获取请求参数列表</pre>
			<div class="well background-white">
			
			<c:choose>
				<c:when test="${empty param_map}">
					<p>参数列表为空</p>
				</c:when>
				<c:otherwise>
					<p>参数个数: <c:out value="${fn:length(param_map)}"/></p>
					<ul>
						<c:forEach var="item" items="${param_map}">
							<li><c:out value="${item.key}"/>=<c:out value="${item.value}"/></li>
						</c:forEach>
					</ul>		
				</c:otherwise>
			</c:choose>
			
			</div>
		</div>
		
		<div class="well">
			<legend>Struts2标签测试</legend>
			<pre title="测试描述">Do Sth</pre>
			<div class="well background-white">
				<s:form id="testform" action="/test.jsp" cssClass="form-horizontal">
					<div class="control-group">
						<s:label cssClass="control-label" for="input1" value="Input 1" />
						<div class="controls">
							<s:textfield name="input1" id="input1" placeholder="Please Input" />
						</div>
					</div>
					<div class="control-group">
						<s:label cssClass="control-label" for="input3" value="Input 2" />
						<div class="controls">
							<s:textfield name="input2" id="var1" placeholder="Please Input" />
						</div>
					</div>
					<div class="control-group">
						<s:label cssClass="control-label" for="input3" value="Input 3" />
						<div class="controls">
							<s:textfield name="input3" id="input3" placeholder="Please Input" />
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<s:submit cssClass="btn btn-primary" value="Submit" />
						</div>
					</div>
				</s:form>
			</div>
		</div>
	</div>
</div>
</body>
</html>